package com.sufun.wekit;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.sufun.base.SFBaseApplication;
/**
 * 图片显示控件
 * @author Wu
 *
 */
public class SFImageView extends ImageView {

	public SFImageView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		this.setScaleType(ScaleType.FIT_XY);
		// TODO Auto-generated constructor stub
	}

	public SFImageView(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.setScaleType(ScaleType.FIT_XY);
		// TODO Auto-generated constructor stub
	}

	public SFImageView(Context context) {
		super(context);
		this.setScaleType(ScaleType.FIT_XY);
		// TODO Auto-generated constructor stub
	}
	/**
	 * 设置图片所在的地址
	 */
	public void SFSetImageUrl(String url)
	{
			SFBaseApplication.shareSFApplication().imageLoader.displayImage(url, this,SFBaseApplication.shareSFApplication().options);		
	}
	/**
	 * 自带有显示效果的option图片下载器
	 * @param url
	 * @param opt
	 */
	public void SFSetImageUrl(String url,DisplayImageOptions opt)
	{
		if (opt==null) {
			SFBaseApplication.shareSFApplication().imageLoader.displayImage(url, this,SFBaseApplication.shareSFApplication().options);
		}
		else {
			SFBaseApplication.shareSFApplication().imageLoader.displayImage(url, this,opt);
		}
	}
	
}
